package com.wlient.basic.Controller;

import com.wlient.basic.designPattern.factory.ConfigQueryFactory;
import com.wlient.basic.designPattern.factory.base.BaseConfig;
import com.wlient.basic.pojo.User;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author: 史炜立
 * @date: 2022/3/9 15:39
 */
@RestController
@Slf4j
public class UserController {

    @Resource
    private ConfigQueryFactory configQueryFactory;

    @GetMapping("/getUser")
    public User getUser(){
        User user = new User(1,"周颖",20,123);
        return user;
    }

    @GetMapping("/getType")
    public void getType(){
        BaseConfig baseConfig = configQueryFactory.of(1);
//        BaseConfig baseConfig = new SchoolConfig();
        System.out.println(baseConfig);
        log.info(baseConfig.toString());
    }
}
